<template>
    <div class="timehello">
        <div>
            <h4>{{ greeting }}</h4>
            <span>点亮在社区的每一天</span>
        </div>
        <div>
            <button>去签到</button>
        </div>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const greeting = ref('上午好!');

function setGreeting() {
    const now = new Date();
    const hour = now.getHours();
    if (hour < 12) {
        greeting.value = '上午好！';
    } else if (hour >= 12 && hour < 18) {
        greeting.value = '下午好！';
    } else {
        greeting.value = '晚上好！';
    }
}

setGreeting();
</script>

<style lang="scss" scoped>
@import url(../../../assets/rightcontent/timehello.scss);
</style>